Skip to content

create cli flag for light mode#646

Closed
S1nus wants to merge 18 commits intomainfrom
connor/light-mode
Closed

create cli flag for light mode#646
S1nus wants to merge 18 commits intomainfrom
connor/light-mode

Conversation

@S1nus
Copy link
Copy Markdown
Contributor

@S1nus S1nus commented Dec 5, 2022

Overview

Adds a CLI option for running Rollmint as a light client.

Resolves #642, #651, #650

Checklist

  • New and updated code has appropriate documentation
  • New and updated code has new and/or updated testing
  • Required CI checks are passing
  • Visual proof for any user facing features like CLI or documentation updates
  • Linked issues closed with keywords

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Dec 5, 2022

Codecov Report

Merging #646 (a3dc5f6) into main (7ced28a) will increase coverage by 0.11%.
The diff coverage is 60.96%.

@@            Coverage Diff             @@
##             main     #646      +/-   ##
==========================================
+ Coverage   55.46%   55.58%   +0.11%     
==========================================
  Files          50       52       +2     
  Lines       10293    10421     +128     
==========================================
+ Hits         5709     5792      +83     
- Misses       3722     3761      +39     
- Partials      862      868       +6     
Impacted Files Coverage Δ
node/light_node.go 0.00% <0.00%> (ø)
node/node.go 72.00% <50.00%> (+11.28%) ⬆️
node/full_node.go 60.82% <60.82%> (ø)
rpc/client/client.go 51.61% <88.33%> (+1.32%) ⬆️
config/config.go 88.46% <100.00%> (+0.46%) ⬆️
da/mock/mock.go 79.54% <0.00%> (ø)
types/hashing.go 100.00% <0.00%> (ø)
da/celestia/celestia.go 50.00% <0.00%> (ø)
state/executor.go 69.75% <0.00%> (+0.07%) ⬆️
conv/abci/block.go 94.33% <0.00%> (+0.10%) ⬆️
... and 5 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Copy Markdown
Contributor

@tzdybal tzdybal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments. You also need to fix tests.

Comment thread rpc/client/client.go Outdated
Comment thread node/full_node.go
@@ -0,0 +1,349 @@
package node
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would love to see continuous git history for this code. Ideally full_node.go should be "detected" as moved & edited version of node.go. Probably, node.go you'll need two commits - first with move (node.go->full_node.go), second with creation of new node.go file.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there some way i can restore it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

73ggiq

Comment thread rpc/server.go Outdated
Comment thread node/node.go
@@ -48,37 +34,26 @@ const (

// Node represents a client node in rollmint network.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the comment can be updated to represent that Node is interface

Comment thread node/node.go
Comment thread node/node.go Outdated
Comment thread node/node.go Outdated
Comment thread node/node_test.go Outdated
key, _, _ := crypto.GenerateEd25519Key(rand.Reader)
signingKey, _, _ := crypto.GenerateEd25519Key(rand.Reader)
node, err := NewNode(context.Background(), config.NodeConfig{DALayer: "mock"}, key, signingKey, abcicli.NewLocalClient(nil, app), &types.GenesisDoc{ChainID: "test"}, log.TestingLogger())
node, err := newFullNode(context.Background(), config.NodeConfig{DALayer: "mock"}, key, signingKey, abcicli.NewLocalClient(nil, app), &types.GenesisDoc{ChainID: "test"}, log.TestingLogger())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this still use NewNode with config.Light set?

Comment thread node/node_test.go Outdated
anotherKey, _, _ := crypto.GenerateEd25519Key(rand.Reader)

node, err := NewNode(context.Background(), config.NodeConfig{DALayer: "mock"}, key, signingKey, abcicli.NewLocalClient(nil, app), &types.GenesisDoc{ChainID: "test"}, log.TestingLogger())
node, err := newFullNode(context.Background(), config.NodeConfig{DALayer: "mock"}, key, signingKey, abcicli.NewLocalClient(nil, app), &types.GenesisDoc{ChainID: "test"}, log.TestingLogger())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this one, it tests things that are specific to FullNodes. I just updated it to use NewNode, but now it casts to FullNode.

Comment thread rpc/client/client.go
checkTxResCh := make(chan *abci.Response, 1)
err = c.node.Mempool.CheckTx(tx, func(res *abci.Response) {
mp := c.node.GetMempool()
err = mp.CheckTx(tx, func(res *abci.Response) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can inline the code c.node.GetMempool().CheckTx( since there is only single use for mp
similarly for c.node.GetP2P().GossipTx(
for more than 1 use, you can have a separate variable defined

@gupadhyaya
Copy link
Copy Markdown
Contributor

@S1nus @tzdybal i am also not a big fan of naming the files full_node.go and light_node.go, i would prefer just full.go and light.go as these files are already under node package.

@tzdybal tzdybal marked this pull request as ready for review January 2, 2023 16:08
@tzdybal
Copy link
Copy Markdown
Contributor

tzdybal commented Jan 3, 2023

I start to lean into abandoning this PR completely and directly implementing #661. 🤔

@jcstein jcstein mentioned this pull request Jan 5, 2023
@nashqueue nashqueue mentioned this pull request Jan 6, 2023
@tzdybal
Copy link
Copy Markdown
Contributor

tzdybal commented Jan 12, 2023

Closing in favor of #681.

@tzdybal tzdybal closed this Jan 12, 2023
@tzdybal tzdybal deleted the connor/light-mode branch January 12, 2023 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add option to run in light client mode

4 participants